﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="磁粉探伤废品判定管理.aspx.cs" Inherits="syc.ZhiJian.磁粉探伤废品判定管理" %>

<html >
<head runat="server">
    <title></title>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script> 
<form id="form1" runat="server">
<asp:Label ID="SqlText" runat="server" Text="" Visible="false"></asp:Label>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
SelectCommand="select 0 as ID,'全部' as 名称 union select ID,名称 FROM 原料供货单位"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>"
onselected="SqlDataSource1_Selected" 
>
<DeleteParameters>
<asp:Parameter Name="ID" DbType="Int32" Size="4" />
</DeleteParameters>
</asp:SqlDataSource>
<div id="wintop" class="wintop">废品接箍判定管理</div>
<asp:Panel ID="Panel2" runat="server" CssClass="panel" GroupingText="记录查询">
供货单位：<asp:DropDownList 
    ID="GongHuo" runat="server" DataSourceID="SqlDataSource2"  Width="120" Font-Size="14px"
    DataTextField="名称" DataValueField="ID"></asp:DropDownList>
<span style="margin-left:5px;">
品名：<asp:DropDownList ID="LeiBie" runat="server" Width="120" Font-Size="14px">
    <asp:ListItem Text="全部" Value="0"></asp:ListItem>
    <asp:ListItem Text="油管接箍(J55)" Value="1"></asp:ListItem>
    <asp:ListItem Text="套管接箍(J55)" Value="2"></asp:ListItem>  
    <asp:ListItem Text="油管接箍(N80)" Value="3"></asp:ListItem>
    <asp:ListItem Text="套管接箍(N80)" Value="4"></asp:ListItem>  
    </asp:DropDownList>
 <span style="margin-left:5px;">
废品类型：<asp:DropDownList ID="LeiXing" runat="server" Width="120" Font-Size="14px">
    <asp:ListItem Text="磁粉探伤" Value="1"></asp:ListItem>
    <asp:ListItem Text="车丝" Value="2"></asp:ListItem>
    </asp:DropDownList>
<span style="margin-left:28px;">
<div style="font-size:6px;height:6px;line-height:6px;"></div>
日期范围：<asp:TextBox ID="Date1" runat="server" CssClass="textbox" Width="105px"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));" />
至 <asp:TextBox ID="Date2" runat="server" CssClass="textbox" Width="105px"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date2').value, document.getElementById('Date2'));" />

<span style="margin-left:10px;"></span>

<asp:Button ID="Button_Query" runat="server" Text="查 询" UseSubmitBehavior="false" 
        CssClass="mbutton" onclick="Button_Query_Click" />

<asp:Button ID="Button_Reset" runat="server" Text="清空条件" UseSubmitBehavior="false" 
        CssClass="mbutton" onclick="Button_Reset_Click" />
</asp:Panel>
    <asp:Panel ID="Panel4" runat="server" CssClass="panel2">
        <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt"></asp:Label>
    </asp:Panel>
    
  <div class="gridframe">
    <div class="gridview">
    
        <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#e5cfab">
             <tr>
		           <td class="grid-title"><div style="float:left;margin-top:3px;">磁粉探伤废品记录</div><div style="float:right;">
                    <asp:DropDownList ID="PageSizeOption" runat="server" AutoPostBack="True" 
                        onselectedindexchanged="PageSizeOption_SelectedIndexChanged">
                    <asp:ListItem Value="10" >10 项/页</asp:ListItem>
                    <asp:ListItem Value="20" Selected="True">20 项/页</asp:ListItem>
                    <asp:ListItem Value="30">30 项/页</asp:ListItem>
                    <asp:ListItem Value="50">50 项/页</asp:ListItem>
                    <asp:ListItem Value="100">100 项/页</asp:ListItem>
                    </asp:DropDownList></div>
	            </td>		          
		     </tr> 
	        <tr>
	            <td class="grid-back">        
                  <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                        AutoGenerateColumns="False" CssClass="grid" DataKeyNames="" 
                        DataSourceID="SqlDataSource1"
                        PageSize="10"
                        GridLines="None" ondatabound="GridView1_DataBound" 
                        onpageindexchanged="GridView1_PageIndexChanged" AllowSorting="True" 
                        UseAccessibleHeader="False" 
                        onselectedindexchanged="GridView1_SelectedIndexChanged">
                        <PagerSettings Visible="False" />
                        <RowStyle CssClass="grid-row-normal" />
                        <Columns>                        
                            <asp:TemplateField HeaderText="">
                            <ItemTemplate>
                                <asp:Button ID="Button1" runat="server" CommandName="Select" Text="选择" CssClass="hide"/>
                                <img src="/Icons/online.gif" style="margin-top:2px;" alt="" />
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="20px" />
                        </asp:TemplateField>                        
                         <asp:TemplateField HeaderText="供货单位" >
                            <ItemTemplate>
                                <asp:Label ID="Label4" runat="server" Text='<%# Bind("供货单位") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                        </asp:TemplateField>                        
                        
                        <asp:TemplateField HeaderText="接箍类别" >
                            <ItemTemplate>
                                <asp:Label ID="Label5" runat="server" Text='<%# Bind("品名") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="100px" />
                        </asp:TemplateField>
                        
                         <asp:TemplateField HeaderText="炉号" >
                            <ItemTemplate>
                                <asp:Label ID="Label9" runat="server" Text='<%# Bind("炉号") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="80px" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="废品支数">
                            <ItemTemplate>
                                <asp:Label ID="Label6" runat="server" Text='<%# Eval("废品支数") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="60px" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="不合格原因">
                            <ItemTemplate>
                                <asp:Label ID="Label7" runat="server" Text='<%# Eval("原因") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="80px" />
                        </asp:TemplateField>
                        
                        <asp:TemplateField HeaderText="生产日期" SortExpression="生产日期">
                            <ItemTemplate>
                                <asp:Label ID="Label3" runat="server" Text='<%# Bind("日期","{0:yyyy-MM-dd}") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="70px" />
                        </asp:TemplateField>  
                         <asp:TemplateField HeaderText="是否判定" ItemStyle-CssClass="grid" HeaderStyle-CssClass="grid-header"
                                    ItemStyle-HorizontalAlign="center" ItemStyle-Width="80" >
                                    <ItemTemplate>                                                                           
                                        <asp:CheckBox ID="CheckBox1" runat="server"  Checked='<%# Bind("是否判定") %>' ToolTip='<%# Eval("进度ID") %>' oncheckedchanged="CheckBox1_CheckedChanged" AutoPostBack="True"
                                             ></asp:CheckBox>
                                    </ItemTemplate>

<HeaderStyle CssClass="grid-header"></HeaderStyle>
                                   <ItemStyle HorizontalAlign="Center" CssClass="grid" Width="60px"></ItemStyle>
                                </asp:TemplateField>
                       <asp:TemplateField HeaderText="判定日期" SortExpression="判定日期">
                            <ItemTemplate>
                                <asp:Label ID="Label8" runat="server" Text='<%# Bind("判定日期","{0:yyyy-MM-dd}") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="70px" />
                        </asp:TemplateField>                         
                       
                        
                          <asp:TemplateField HeaderText="产品ID" Visible="false">
                            <ItemTemplate>
                                <asp:Label ID="Label11" runat="server" Text='<%# Eval("产品类别ID") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="grid-header" />
                            <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="80px" />
                        </asp:TemplateField>
                                <asp:TemplateField ShowHeader="False" Visible="false">
                                    <ItemTemplate>
<input id="mxbu" type="button" value="明细" class="smallbutton" onclick="parent.swin2_load('/zhijian/废品判定通知书.aspx?pm=<%#Eval("产品类别ID") %>&&zs=<%#Eval("废品支数") %>&&ghs=<%#Eval("供货单位") %>&&lh=<%#Eval("炉号") %>&&pd=<%#Eval("是否判定") %>&&rq=<%# Eval("判定日期") %>&&yy=<%# Eval("原因")%>',820,600,'yes');" />
                                    </ItemTemplate>
                                </asp:TemplateField>                          
                         
                        </Columns>
                        <SelectedRowStyle CssClass="grid-row-selected" />
                      </asp:GridView>                    
                      
                      
                   
	            </td>
            </tr>
            <tr>
	            <td>   
	                <table width="100%">
	                    <tr>
	                        <td class="pagebar">
                                <asp:Button ID="Button_Pager_First" UseSubmitBehavior="false" runat="server" Text="" ToolTip="首页" 
                                    CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                <asp:Button ID="Button_Pager_Prev" UseSubmitBehavior="false" runat="server" Text="" ToolTip="上一页" 
                                    CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                <input type="button" class="page-split" UseSubmitBehavior="false" disabled />第<asp:TextBox 
                                    ID="TextBox_Pager" AutoPostBack="True" runat="server" CssClass="pageturn" 
                                    ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" disabled /><asp:Label ID="Label_Pages" UseSubmitBehavior="false" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                                
                                <asp:Button ID="Button_Pager_Next" UseSubmitBehavior="false" runat="server" Text="" ToolTip="下一页" 
                                    CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                <asp:Button ID="Button_Pager_Last" UseSubmitBehavior="false" runat="server" Text="" ToolTip="末页" 
                                    CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" /><asp:Label ID="Label9" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                            </td>
                            <td class="pagebar" align="right">
                                <asp:Label ID="Label_Total" runat="server"></asp:Label>
                            </td>
                        </tr>
                   </table>

	            </td>
            </tr>
        </table>
        

    </div>
</div>

</form>
<script>
    var notice = '<%=this.Notice %>';
    if (notice != '') {
        parent.showmsgbox(notice);
    }
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            //textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "intxt2") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }
    }
    var rows = document.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++) {

        if (rows[i].className == "grid-row-normal") {
            rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
            rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
            rows[i].onclick = selectRow;
        }
    }
    document.onkeydown = function(e) {
        if (!e) e = window.event;
        var tag = e.srcElement;
        if (!tag) tag = e.target;
        if (tag.tagName == "INPUT" && tag.className == "textbox" || tag.tagName == "SELECT") {
            if (e.keyCode == 13) e.keyCode = 9;
        }
    }

    var rows = document.getElementById("GridView1").rows;
    var sum1 = 0;
    var n1;
    for (i = 1; i < rows.length; i++) {
        n1 = Number(rows[i].cells[4].innerText);
       
        if (n1 >= 0) {
            sum1 += n1;       
        }       
    }
    var total = document.getElementById("Label_Total");
    total.innerHTML += "　　本页小计：" + (rows.length - 1) + " 项 废品支数：" + sum1 + "支 ";

</script>
</body>
</html>
